<div class="edit">
    <form id="editForm" method="post">
        <div id="win"></div>
        <table class="infobox" width="100%" border="0" cellspacing="5px"
               cellpadding="1px">
            <tr>
                <td width="23%"><label>名称：</label></td>
                <td width="77%"><input name="name" type="text" style="width:200px;" value="${(pharmacy.name)!''}"
                                       class="easyui-validatebox" autocomplete="off"/></td>
            </tr>
            <tr>
                <td width="23%"><label>联系人：</label></td>
                <td width="77%"><input name="contactName" type="text" style="width:200px;" value="${(pharmacy.contactName)!''}"
                                       class="easyui-validatebox" autocomplete="off"/></td>
            </tr>
            <tr>
                <td width="23%"><label>联系电话：</label></td>
                <td width="77%"><input name="contactPhone" type="text" style="width:200px;" value="${(pharmacy.contactPhone)!''}"
                                       class="easyui-validatebox" autocomplete="off"/></td>
            </tr>
            <tr>
                <td width="23%"><label>省份：</label></td>
                <td width="77%">
                    <input class="easyui-combobox" name="province" id="province" style="width:200px" required="true"
                           panelHeight="250px" value="${(pharmacy.province)!''}"
                           data-options="editable:false">
                </td>
            </tr>
            <tr>
                <td width="23%"><label>城市：</label></td>
                <td width="77%">
                    <input class="easyui-combobox" name="city" id="city" style="width:200px" required="true"
                           panelHeight="250px" value="${(pharmacy.city)!''}"
                           data-options="editable:false">
                </td>
            </tr>
            <tr>
                <td width="23%"><label>区县：</label></td>
                <td width="77%">
                    <input class="easyui-combobox" name="district" id="district" style="width:200px" required="true"
                           panelHeight="250px" value="${(pharmacy.district)!''}"
                           data-options="editable:false">
                </td>
            </tr>
            <tr>
                <td width="23%"><label>地址：</label></td>
                <td width="77%"><input name="address" id="address"  style="width:200px;" value="${(pharmacy.address)!''}"
                                       class="easyui-validatebox" autocomplete="off"/></td>
            </tr>
            <tr>
                <td width="23%"><label>经纬度：</label></td>
                <td width="77%"><input name="location" id="location"  style="width:200px;" value="${(pharmacy.location)!''}"
                                       class="easyui-validatebox" autocomplete="off"/>
                <#--<a href="#" class="easyui-linkbutton" icon="icon-eye" onclick="getLocation()">打开地图</a>-->
                </td>
            </tr>
            <tr>
                <td width="23%"><label>区域：</label></td>
                <td width="77%"><input name="area" id="area"  style="width:200px;" value="${(pharmacy.area)!''}"
                                       class="easyui-validatebox" autocomplete="off"/>
                <#--<a href="#" class="easyui-linkbutton" icon="icon-add" onclick="getArea()">区域处理</a>-->
                </td>
            </tr>
            <tr>
                <td width="23%"><label>备注：</label></td>
                <td width="77%"><input name="remark"  style="width:200px;" value="${(pharmacy.remark)!''}"
                                       class="easyui-validatebox" autocomplete="off"/></td>
            </tr>
        </table>
        <input hidden type="text" name="id" value="${(pharmacy.id)!''}">
    </form>
</div>
<script type="text/javascript">
    $('#province').combobox({
        url: '/common/getRegionChildren?pid=1',
        valueField: 'id',
        textField: 'name',
        onChange:function (n,o) {
            $('#city').combobox('clear');
                var url='/common/getRegionChildren?pid='+n;
                $('#city').combobox('reload', url);
        }
    });
    var firstDefaultValue=${(pharmacy.province)!"-1"}+"";
    if(firstDefaultValue===''||firstDefaultValue===null) {
        firstDefaultValue='-1';
    }
    $('#city').combobox({
        url: '/common/getRegionChildren?pid='+firstDefaultValue,
        valueField: 'id',
        textField: 'name',
        onChange:function (n,o) {
            $('#district').combobox('clear');
            var url='/common/getRegionChildren?pid='+n;
            $('#district').combobox('reload', url);

        }
    });

    var secondDefaultValue=${(pharmacy.city)!"-1"}+"";
    if(secondDefaultValue===""||secondDefaultValue===null) {
        secondDefaultValue="-1";
    }
    $('#district').combobox({
        url: '/common/getRegionChildren?pid='+secondDefaultValue,
        valueField: 'id',
        textField: 'name',
    });

    function getLocation() {
        var location=$("#location").val();
        var address=$("#address").val();
        $("<div></div>").dialog({
            id:'locationView',
            title:'编辑',
            resizable: true,
            closable: true,
            width: 600,
            height: 500,
            modal:true,
            href: "/pharmacy/openLocation?location="+location+"&address="+address,
            onClose:function () {
                $("#locationView").dialog('destroy');
            },
        });
        $("#locationView").dialog('maximize');
    }
</script>